﻿using checc_baseTools.CaveMouth.Entity;
using Culvert_Help;
using NeXus;
using NeXus.BIMBase.Core;
using NeXus.p3d;
using System;
using static NeXus.p3d.GeCurveArray;

namespace checc_baseTools.CaveMouth
{
    public class HeadFall
    {
        private readonly HeadFallBase headFallBase;
        //洞口宽度 净宽
        private readonly double holeWidth;
        //洞口夹角 角度
        private readonly double heleAngle;
        public HeadFall(HeadFallBase headFallBase, double holeWidth, double heleAngle)
        {
            this.headFallBase = headFallBase;
            this.holeWidth = holeWidth * Culvert_Help.GeneralHelpers.UOR;
            this.heleAngle = heleAngle;
        }

        public BPGraphicsCollection CreateEntityModel()
        {
            BPProject bPProject = BPApplication.getInstance().getProjectManager().getMainProject();
            BPModelBase model = bPProject.getActiveModel();

            var objParameter = GetUorCoverParameter();
            //排水沟深度+铺底厚度
            double height = objParameter.gutterwayDepth + objParameter.paveBottomThickness;
            double length = objParameter.paveBottomThickness * objParameter.gutterwaySlopeRatio;
            double slope = Math.Abs(objParameter.endlongSlope * 0.01);
            //objParameter.angleFlare *= 0.01;

            //铺砌长度y值偏移长度 = 截水墙厚 * tan扩散角度;
            double offLength = objParameter.paveLength * Math.Tan(Math.Abs(Math.PI * objParameter.angleFlare / 180));
            //截水墙厚z值纵坡长度 = 截水墙厚 * 纵坡坡比;
            double slopeLength = objParameter.paveLength * slope;
            //顶视图洞口朝向右侧  右上角顺时针加入各点
            GePoint3dCollection ptInside = new GePoint3dCollection()
            {
                new GePoint3d( 0, holeWidth * 0.5 + objParameter.sideWidth, 0),
                new GePoint3d( 0, holeWidth * 0.5 + objParameter.sideWidth + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio, height-objParameter.paveBottomThickness),
                new GePoint3d( 0, holeWidth * 0.5 + objParameter.sideWidth + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio + objParameter.gutterrwayWallWidth, height-objParameter.paveBottomThickness),
                new GePoint3d( 0, holeWidth * 0.5 + objParameter.sideWidth + objParameter.gutterrwayWallWidth - length, -objParameter.paveBottomThickness),
                new GePoint3d( 0, -(holeWidth * 0.5 + objParameter.sideWidth + objParameter.gutterrwayWallWidth - length), -objParameter.paveBottomThickness),
                new GePoint3d( 0, -(holeWidth * 0.5 + objParameter.sideWidth + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio + objParameter.gutterrwayWallWidth),height-objParameter.paveBottomThickness),
                new GePoint3d( 0, -(holeWidth * 0.5 + objParameter.sideWidth + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio), height-objParameter.paveBottomThickness),
                new GePoint3d( 0, -(holeWidth * 0.5 + objParameter.sideWidth), 0),
            };
            //顶视图洞口朝向右侧  右上角顺时针加入各点
            GePoint3dCollection ptOutside = new GePoint3dCollection()
            {
                new GePoint3d(objParameter.paveLength, ptInside[0].y + offLength, ptInside[0].z - slopeLength),
                new GePoint3d(objParameter.paveLength, ptInside[1].y + offLength, ptInside[0].z - slopeLength + objParameter.gutterwayDepth),
                new GePoint3d(objParameter.paveLength, ptInside[2].y + offLength, ptInside[0].z - slopeLength + objParameter.gutterwayDepth),
                new GePoint3d(objParameter.paveLength, ptInside[3].y + offLength, ptInside[0].z - slopeLength - objParameter.paveBottomThickness),
                new GePoint3d(objParameter.paveLength, ptInside[4].y - offLength, ptInside[0].z - slopeLength - objParameter.paveBottomThickness),
                new GePoint3d(objParameter.paveLength, ptInside[5].y -offLength, ptInside[0].z - slopeLength + objParameter.gutterwayDepth),
                new GePoint3d(objParameter.paveLength, ptInside[6].y -offLength, ptInside[0].z - slopeLength + objParameter.gutterwayDepth),
                new GePoint3d(objParameter.paveLength, ptInside[7].y -offLength, ptInside[0].z - slopeLength)
            };

            GeCurveArray inSide = GeCurveArray.createLinestringArray(ptInside, BoundaryType.BOUNDARY_TYPE_Outer, true);
            GeCurveArray outSide = GeCurveArray.createLinestringArray(ptOutside, BoundaryType.BOUNDARY_TYPE_Outer, true);
            GeRuledSweepInfo rule = new GeRuledSweepInfo(inSide, outSide, true);
            IGeSolidBase staircaseWaterfalls = IGeSolidBase.createGeRuledSweep(rule);
            BPGraphics staircaseWaterfallsGP = model.createPhysicalGraphics();
            staircaseWaterfallsGP.addSolid(staircaseWaterfalls);
            //staircaseWaterfallsGP.save();
            #region 截水
            //截水墙厚y值偏移长度 = 截水墙厚 * tan扩散角度;
            offLength = objParameter.cutoffWallThickness * Math.Tan(Math.Abs(Math.PI * objParameter.angleFlare / 180));
            //截水墙厚z值纵坡长度 = 截水墙厚 * 纵坡坡比;
            slopeLength = objParameter.cutoffWallThickness * slope;
            //从顶视图洞口朝向右侧 截水墙左下角逆时针顺序加入各点
            GePoint3dCollection ptTop = new GePoint3dCollection()
            {
                new GePoint3d(ptOutside[3].x - objParameter.cutoffWallThickness, ptOutside[3].y - offLength, ptOutside[3].z + slopeLength),
                new GePoint3d(ptOutside[3].x,ptOutside[3].y,ptOutside[3].z),
                new GePoint3d(ptOutside[4].x,ptOutside[4].y,ptOutside[4].z),
                new GePoint3d(ptOutside[4].x - objParameter.cutoffWallThickness, ptOutside[4].y + offLength, ptOutside[4].z + slopeLength),
            };

            GeCurveArray topSide = GeCurveArray.createLinestringArray(ptTop, BoundaryType.BOUNDARY_TYPE_Outer, true);
            GeExtrusionInfo extrusionInfo = new GeExtrusionInfo(topSide, new GeVec3d(0, 0, -objParameter.cutoffWallHeight), true);
            //参数:拉伸体 返回:一个 IGeSolidBase 
            var waterInterception = IGeSolidBase.createGeExtrusion(extrusionInfo);
            BPGraphics waterInterceptionGP = model.createPhysicalGraphics();
            waterInterceptionGP.addSolid(waterInterception);
            //waterInterceptionGP.save();
            BPGraphics all = Element_solid.BoolCollection(waterInterceptionGP, staircaseWaterfallsGP, false);

            #endregion
            //旋转洞口角度
            all = Helper.unitRotation(all, 90 - heleAngle);
            //返回锥坡底面四个点的平面
            GePoint3dCollection gePoint3Ds = new GePoint3dCollection()
            {
                ptInside[2], ptOutside[2], ptOutside[5],ptInside[5]
            };
            GeCurveArray geCurveArray = GeCurveArray.createLinestringArray(gePoint3Ds, BoundaryType.BOUNDARY_TYPE_Outer, true);
            BPGraphics plan = GeneralHelpers.Model2D.createPhysicalGraphics();
            plan.addCurveArray(geCurveArray);
            plan = Helper.unitRotation(plan, 90 - heleAngle);
            return new BPGraphicsCollection { all, plan };
        }

        private (double angleFlare, double endlongSlope, double sideWidth, double cutoffWallThickness, double paveBottomThickness, double height, double paveLength, double cutoffWallHeight, double gutterwayDepth, double gutterrwayWallWidth, double gutterwaySlopeRatio) GetUorCoverParameter()
        {
            double angleFlare = this.headFallBase.AngleFlare;// 扩散角
            double endlongSlope = this.headFallBase.EndlongSlope;// 洞口纵坡
            double sideWidth = this.headFallBase.SideWidth * Culvert_Help.GeneralHelpers.UOR;// 洞口侧加宽
            double cutoffWallThickness = this.headFallBase.CutoffWallThickness * Culvert_Help.GeneralHelpers.UOR;// 截水墙厚度
            double paveBottomThickness = this.headFallBase.PaveBottomThickness * Culvert_Help.GeneralHelpers.UOR;// 铺底厚度
            double height = this.headFallBase.Height * Culvert_Help.GeneralHelpers.UOR;// 跌水高度
            double paveLength = this.headFallBase.PaveLength * Culvert_Help.GeneralHelpers.UOR;// 铺砌长度
            double cutoffWallHeight = this.headFallBase.CutoffWallHeight * Culvert_Help.GeneralHelpers.UOR;// 截水墙高度
            double gutterwayDepth = this.headFallBase.GutterwayDepth * Culvert_Help.GeneralHelpers.UOR;// 排水沟深度
            double gutterrwayWallWidth = this.headFallBase.GutterrwayWallWidth * Culvert_Help.GeneralHelpers.UOR;// 排水沟壁宽
            double gutterwaySlopeRatio = this.headFallBase.GutterwaySlopeRatio;// 排水沟坡比
            return (angleFlare, endlongSlope, sideWidth, cutoffWallThickness, paveBottomThickness, height, paveLength, cutoffWallHeight, gutterwayDepth, gutterrwayWallWidth, gutterwaySlopeRatio);
        }

        #region ORD跌水
        //public void CreateEntityModel()
        //{
        //    var objParameter = GetUorCoverParameter();
        //    //排水沟深度+铺底厚度
        //    double height = objParameter.gutterwayDepth + objParameter.paveBottomThickness;
        //    double length = objParameter.paveBottomThickness * objParameter.gutterwaySlopeRatio;
        //    double slope = Math.Abs(objParameter.endlongSlope * 0.01);
        //    objParameter.angleFlare *= 0.01;
        //    //洞口内侧
        //    GePoint3d[] dPInside =
        //    {
        //        new GePoint3d(0,holeWidth * 0.5 + objParameter.sideWiden,objParameter.paveBottomThickness),
        //        new GePoint3d(0,holeWidth * 0.5 + objParameter.sideWiden+objParameter.gutterwayDepth*objParameter.gutterwaySlopeRatio,height) ,
        //        new GePoint3d(0,holeWidth * 0.5 + objParameter.sideWiden+objParameter.gutterwayDepth*objParameter.gutterwaySlopeRatio+objParameter.gutterrwayWallWidth,height) ,
        //        new GePoint3d(0,holeWidth * 0.5 + objParameter.sideWiden+objParameter.gutterrwayWallWidth-length,0) ,
        //        new GePoint3d(0,-(holeWidth * 0.5+objParameter.sideWiden+objParameter.gutterrwayWallWidth-length),0) ,
        //        new GePoint3d(0,-(holeWidth * 0.5+objParameter.sideWiden+objParameter.gutterwayDepth*objParameter.gutterwaySlopeRatio+objParameter.gutterrwayWallWidth),height) ,
        //        new GePoint3d(0,-(holeWidth * 0.5 + objParameter.sideWiden+objParameter.gutterwayDepth*objParameter.gutterwaySlopeRatio),height) ,
        //        new GePoint3d(0,-(holeWidth * 0.5 + objParameter.sideWiden),objParameter.paveBottomThickness) ,
        //    };

        //    //洞口外侧
        //    GePoint3d[] dPOutside =
        //    {
        //        new GePoint3d(objParameter.paveLength, (1 + objParameter.angleFlare) * dPInside[0].y, dPInside[0].z - ((objParameter.paveLength) * slope)),
        //        new GePoint3d(objParameter.paveLength, (1 + objParameter.angleFlare) * dPInside[1].y, dPInside[0].z - objParameter.paveLength * slope + objParameter.gutterwayDepth),
        //        new GePoint3d(objParameter.paveLength, (1 + objParameter.angleFlare) * dPInside[2].y, dPInside[0].z - objParameter.paveLength * slope + objParameter.gutterwayDepth),
        //        new GePoint3d(objParameter.paveLength, (1 + objParameter.angleFlare) * dPInside[3].y, dPInside[0].z - objParameter.paveLength * slope - objParameter.paveBottomThickness),
        //        new GePoint3d(objParameter.paveLength, (1 + objParameter.angleFlare) * dPInside[4].y, dPInside[0].z - objParameter.paveLength * slope - objParameter.paveBottomThickness),
        //        new GePoint3d(objParameter.paveLength, (1 + objParameter.angleFlare) * dPInside[5].y, dPInside[0].z - objParameter.paveLength * slope + objParameter.gutterwayDepth),
        //        new GePoint3d(objParameter.paveLength, (1 + objParameter.angleFlare) * dPInside[6].y, dPInside[0].z - objParameter.paveLength * slope + objParameter.gutterwayDepth),
        //        new GePoint3d(objParameter.paveLength, (1 + objParameter.angleFlare) * dPInside[7].y, dPInside[0].z - objParameter.paveLength * slope)
        //    };

        //    double LeftLateralOffset1 = Math.Abs((holeWidth / 2 + objParameter.sideWiden + objParameter.gutterrwayWallWidth - length) * Math.Tan((90 - heleAngle) * Math.PI / 180));
        //    double LeftLateralOffset2 = Math.Abs((holeWidth / 2 + objParameter.sideWiden) * Math.Tan((90 - heleAngle) * Math.PI / 180));
        //    double LeftLateralOffset3 = Math.Abs((holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio) * Math.Tan((90 - heleAngle) * Math.PI / 180));
        //    double LeftLateralOffset4 = Math.Abs((holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio + objParameter.gutterrwayWallWidth) * Math.Tan((90 - heleAngle) * Math.PI / 180));

        //    if (heleAngle < 90)
        //    {
        //        LeftLateralOffset1 = (-LeftLateralOffset1);
        //        LeftLateralOffset2 = (-LeftLateralOffset2);
        //        LeftLateralOffset3 = (-LeftLateralOffset3);
        //        LeftLateralOffset4 = (-LeftLateralOffset4);
        //        //洞口内侧
        //        dPInside[0] = new GePoint3d(0 - LeftLateralOffset2, holeWidth * 0.5 + objParameter.sideWiden, objParameter.paveBottomThickness + LeftLateralOffset2 * slope);
        //        dPInside[1] = new GePoint3d(0 - LeftLateralOffset3, holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio, height + LeftLateralOffset3 * slope);
        //        dPInside[2] = new GePoint3d(0 - LeftLateralOffset4, holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio + objParameter.gutterrwayWallWidth, height + LeftLateralOffset4 * slope);
        //        dPInside[3] = new GePoint3d(0 - LeftLateralOffset1, holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterrwayWallWidth - length, LeftLateralOffset1 * slope);
        //        dPInside[4] = new GePoint3d(0 + LeftLateralOffset1, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterrwayWallWidth - length), LeftLateralOffset1 * slope);
        //        dPInside[5] = new GePoint3d(0 + LeftLateralOffset4, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio + objParameter.gutterrwayWallWidth), height + LeftLateralOffset4 * slope);
        //        dPInside[6] = new GePoint3d(0 + LeftLateralOffset3, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio), height + LeftLateralOffset3 * slope);
        //        dPInside[7] = new GePoint3d(0 + LeftLateralOffset2, -(holeWidth * 0.5 + objParameter.sideWiden), objParameter.paveBottomThickness + LeftLateralOffset2 * slope);
        //        //洞口外侧
        //        dPOutside[0] = new GePoint3d(0 - LeftLateralOffset2 + objParameter.paveLength, (holeWidth * 0.5 + objParameter.sideWiden) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset2 * slope - (objParameter.paveLength * slope));
        //        dPOutside[1] = new GePoint3d(0 - LeftLateralOffset3 + objParameter.paveLength, (holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio) * (1 + objParameter.angleFlare), height + LeftLateralOffset3 * slope - (objParameter.paveLength * slope));
        //        dPOutside[2] = new GePoint3d(0 - LeftLateralOffset4 + objParameter.paveLength, (holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio + objParameter.gutterrwayWallWidth) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset4 * slope - objParameter.paveLength * slope + objParameter.gutterwayDepth);
        //        dPOutside[3] = new GePoint3d(0 - LeftLateralOffset1 + objParameter.paveLength, (holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterrwayWallWidth - length) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset1 * slope - objParameter.paveLength * slope - objParameter.paveBottomThickness);
        //        dPOutside[4] = new GePoint3d(0 + LeftLateralOffset1 + objParameter.paveLength, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterrwayWallWidth - length) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset1 * slope - objParameter.paveLength * slope - objParameter.paveBottomThickness);
        //        dPOutside[5] = new GePoint3d(0 + LeftLateralOffset4 + objParameter.paveLength, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio + objParameter.gutterrwayWallWidth) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset4 * slope - objParameter.paveLength * slope + objParameter.gutterwayDepth);
        //        dPOutside[6] = new GePoint3d(0 + LeftLateralOffset3 + objParameter.paveLength, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio) * (1 + objParameter.angleFlare), height + LeftLateralOffset3 * slope - (objParameter.paveLength * slope));
        //        dPOutside[7] = new GePoint3d(0 + LeftLateralOffset2 + objParameter.paveLength, -(holeWidth * 0.5 + objParameter.sideWiden) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset2 * slope - (objParameter.paveLength * slope));
        //    }
        //    else if (heleAngle > 90)
        //    {
        //        //洞口内侧
        //        dPInside[0] = new GePoint3d(0 - LeftLateralOffset2, holeWidth * 0.5 + objParameter.sideWiden, objParameter.paveBottomThickness + LeftLateralOffset2 * slope);
        //        dPInside[1] = new GePoint3d(0 - LeftLateralOffset3, holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio, height + LeftLateralOffset3 * slope);
        //        dPInside[2] = new GePoint3d(0 - LeftLateralOffset4, holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio + objParameter.gutterrwayWallWidth, height + LeftLateralOffset4 * slope);
        //        dPInside[3] = new GePoint3d(0 - LeftLateralOffset1, holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterrwayWallWidth - length, LeftLateralOffset1 * slope);
        //        dPInside[4] = new GePoint3d(0 + LeftLateralOffset1, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterrwayWallWidth - length), LeftLateralOffset1 * slope);
        //        dPInside[5] = new GePoint3d(0 + LeftLateralOffset4, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio + objParameter.gutterrwayWallWidth), height + LeftLateralOffset4 * slope);
        //        dPInside[6] = new GePoint3d(0 + LeftLateralOffset3, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio), height + LeftLateralOffset3 * slope);
        //        dPInside[7] = new GePoint3d(0 + LeftLateralOffset2, -(holeWidth * 0.5 + objParameter.sideWiden), objParameter.paveBottomThickness + LeftLateralOffset2 * slope);
        //        //洞口外侧
        //        dPOutside[0] = new GePoint3d(0 - LeftLateralOffset2 + objParameter.paveLength, (holeWidth * 0.5 + objParameter.sideWiden) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset2 * slope - (objParameter.paveLength * slope));
        //        dPOutside[1] = new GePoint3d(0 - LeftLateralOffset3 + objParameter.paveLength, (holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio) * (1 + objParameter.angleFlare), height + LeftLateralOffset3 * slope - (objParameter.paveLength * slope));
        //        dPOutside[2] = new GePoint3d(0 - LeftLateralOffset4 + objParameter.paveLength, (holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio + objParameter.gutterrwayWallWidth) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset4 * slope - objParameter.paveLength * slope + objParameter.gutterwayDepth);
        //        dPOutside[3] = new GePoint3d(0 - LeftLateralOffset1 + objParameter.paveLength, (holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterrwayWallWidth - length) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset1 * slope - objParameter.paveLength * slope - objParameter.paveBottomThickness);
        //        dPOutside[4] = new GePoint3d(0 + LeftLateralOffset1 + objParameter.paveLength, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterrwayWallWidth - length) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset1 * slope - objParameter.paveLength * slope - objParameter.paveBottomThickness);
        //        dPOutside[5] = new GePoint3d(0 + LeftLateralOffset4 + objParameter.paveLength, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio + objParameter.gutterrwayWallWidth) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset4 * slope - objParameter.paveLength * slope + objParameter.gutterwayDepth);
        //        dPOutside[6] = new GePoint3d(0 + LeftLateralOffset3 + objParameter.paveLength, -(holeWidth * 0.5 + objParameter.sideWiden + objParameter.gutterwayDepth * objParameter.gutterwaySlopeRatio) * (1 + objParameter.angleFlare), height + LeftLateralOffset3 * slope - (objParameter.paveLength * slope));
        //        dPOutside[7] = new GePoint3d(0 + LeftLateralOffset2 + objParameter.paveLength, -(holeWidth * 0.5 + objParameter.sideWiden) * (1 + objParameter.angleFlare), objParameter.paveBottomThickness + LeftLateralOffset2 * slope - (objParameter.paveLength * slope));
        //    }
        //    BPGraphics bPGraphics = Helper.seamSealer(dPInside.ToList(), dPOutside.ToList());
        //    bPGraphics.save();

        //    #region 截水
        //    GePoint3d GePoint3d = new GePoint3d(dPOutside[4].x, dPOutside[4].y, dPOutside[4].z - objParameter.cutoffWallHeight);
        //    GePoint3d GePoint3d1 = new GePoint3d(GePoint3d.x - objParameter.cutoffWallThickness, GePoint3d.y, GePoint3d.z);
        //    GePoint3d GePoint3d3 = new GePoint3d(dPOutside[3].x, dPOutside[3].y, dPOutside[3].z - objParameter.cutoffWallHeight);
        //    GePoint3d GePoint3d4 = new GePoint3d(GePoint3d3.x - objParameter.cutoffWallThickness, GePoint3d3.y, GePoint3d3.z);

        //    GePoint3d[] GePoint3ds =
        //    {
        //        new GePoint3d(objParameter.paveLength, (1 + objParameter.angleFlare) * dPInside[3].y, dPOutside[0].z - objParameter.paveBottomThickness),
        //        new GePoint3d(GePoint3d4.x, GePoint3d4.y- objParameter.paveLength - objParameter.gutterwayDepth *(1- objParameter.gutterrwayWallWidth), GePoint3d4.z + objParameter.cutoffWallHeight + objParameter.cutoffWallThickness * slope),
        //        new GePoint3d(GePoint3d3.x - objParameter.cutoffWallThickness, GePoint3d3.y- objParameter.paveLength - objParameter.gutterwayDepth *(1- objParameter.gutterrwayWallWidth), GePoint3d3.z),
        //        new GePoint3d(dPOutside[3].x, dPOutside[3].y, dPOutside[3].z - objParameter.cutoffWallHeight)
        //    };
        //    GePoint3d[] dPoint2Ds =
        //    {
        //        new GePoint3d(objParameter.paveLength, (1 + objParameter.angleFlare) * dPInside[4].y, dPOutside[0].z - objParameter.paveBottomThickness),
        //        new GePoint3d(GePoint3d1.x, GePoint3d1.y + objParameter.paveLength - objParameter.gutterwayDepth *(1- objParameter.gutterrwayWallWidth), GePoint3d1.z + objParameter.cutoffWallHeight + objParameter.cutoffWallThickness * slope),
        //        new GePoint3d(GePoint3d.x - objParameter.cutoffWallThickness, GePoint3d.y + objParameter.paveLength - objParameter.gutterwayDepth *(1- objParameter.gutterrwayWallWidth), GePoint3d.z),
        //        new GePoint3d(dPOutside[4].x, dPOutside[4].y, dPOutside[4].z - objParameter.cutoffWallHeight)
        //    };

        //    if (heleAngle != 90)
        //    {
        //        GeVec3d unitVector = GeVec3d.createByStartEndNormalize(dPOutside[4], dPInside[4]);
        //        GePoint3d translationStartDP = dPOutside[4];
        //        translationStartDP.z = dPOutside[4].z - objParameter.cutoffWallHeight;
        //        GePoint3d translationEndDP = translationStartDP + unitVector * objParameter.cutoffWallThickness;
        //        GePoint3d translationStartDP2 = dPOutside[4];
        //        translationStartDP2.z = dPOutside[4].z;
        //        GePoint3d translationEndDP2 = translationStartDP2 + unitVector * objParameter.cutoffWallThickness;

        //        GePoint3ds[0] = translationStartDP;
        //        GePoint3ds[1] = new GePoint3d(translationEndDP.x, translationEndDP.y, translationEndDP.z - (objParameter.paveLength - objParameter.gutterwayDepth * (1 - objParameter.gutterrwayWallWidth)) * 2);
        //        GePoint3ds[2] = translationEndDP2;
        //        GePoint3ds[3] = dPOutside[4];

        //        GeVec3d unitVector2 = GeVec3d.createByStartEndNormalize(dPOutside[3], dPInside[3]);
        //        GePoint3d translation2StartDP = dPOutside[3];
        //        translation2StartDP.z = dPOutside[3].z - objParameter.cutoffWallHeight;
        //        GePoint3d translation2EndDP = translation2StartDP + unitVector2 * objParameter.cutoffWallThickness;
        //        GePoint3d translation2StartDP2 = dPOutside[3];
        //        translation2StartDP2.z = dPOutside[3].z;
        //        GePoint3d translation2EndDP2 = translation2StartDP2 + unitVector2 * objParameter.cutoffWallThickness;

        //        dPoint2Ds[0] = translation2StartDP;
        //        dPoint2Ds[1] = new GePoint3d(translation2EndDP.x, translation2EndDP.y, translation2EndDP.z - (objParameter.paveLength - objParameter.gutterwayDepth * (1 - objParameter.gutterrwayWallWidth)) * 2);
        //        dPoint2Ds[2] = translation2EndDP2;
        //        dPoint2Ds[3] = dPOutside[3];
        //    }

        //    BPGraphics bPGraphicsJS = Helper.seamSealer(GePoint3ds.ToList(), dPoint2Ds.ToList());
        //    //bPGraphicsJS.save();
        //    #endregion

        //    //BPGraphics resultBPGraphics = Element_solid.BoolCollection(bPGraphics, bPGraphicsJS,false);
        //    //GeTransform transform = GeTransform.create(new GePoint3d(0, 0, -objParameter.paveBottomThickness));
        //    //BPGraphicUtil.transformPhysicalGraphics(ref resultBPGraphics, transform);
        //    //resultBPGraphics.save();
        //}
        #endregion

    }
}
